<template>
  <el-form ref="form" :model="form" label-width="100px" :rules="rules" >
    <el-form-item label="编 码：" prop="dicValue">
      <el-input size="small" v-model="form.dicValue" style="width:330px;"></el-input>
    </el-form-item>
    <el-form-item label="名称：" prop="dicDisplay">
      <el-input size="small" v-model="form.dicDisplay" style="width:330px;"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
let rules = {
  dicDisplay: [{required: true,message:'不可为空'}],
  dicValue: [{required: true,message:'不可为空'}],
}
export default {
  name: "dictForm",
  methods:{
    setData(data){
      Object.keys(this.form).forEach(x=>{
        this.form[x] = data[x]
      })
    },
    validate(){
      return new Promise((res,rej)=>{
        this.$refs.form.validate((v)=>{
          if(v){
            res(v)
          }else{
            rej(v)
          }
        })
      })

    },
  },
  data() {
    return {
      rules:rules,
      form: {
        dicDisplay: '',
        dicParentId: '',
        dicValue: '',
      },
    }
  },
}
</script>

<style scoped>

</style>